home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: nntp.coast.net!torn!nott!emr1!jagrant
- From: jagrant@emr1.emr.ca (John Grant)
- Subject: Re: Where do I put inline functions?
- Message-ID: <Dnnyxs.Fpu@emr1.emr.ca>
- Organization: Energy, Mines, and Resources, Ottawa
- References: <4h7sj0$10a@mother.usf.edu> <4ha0bb$297@aphex.direct.ca>
- Date: Sat, 2 Mar 1996 23:37:04 GMT
-
- In article <4ha0bb$297@aphex.direct.ca> qjackson@direct.ca writes:
- >millert@grad.csee.usf.edu (Timothy Miller) wrote:
- >
- >>Should I put inline functions in .cpp files like normal functions or in
- >>.hpp files like #defines would be in C?
- >
- >"Should" is a dangerous word when it comes to programming.... ;-)
- >
- >A tolerable place to put them is in the .hpp file with the class
- >definition, since they will be needed by the compiler for any file
- >that includes the .hpp. (A bad place to put them would be the .cpp,
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- >since they are compiled only once and then are no longer visible to
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- >the compiler -- how can the compiler include them inline?)
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
- [...some ideas...]
-
- Then why does the compile accept 'inline' in the class
- definition if it can't find the body of the function (which
- might be in the .cpp file)?
-
- If it is meaningless, the compiler should say something like:
- "inline is only valid if the function code is supplied at the
- same time"
- --
- John A. Grant jagrant@emr1.emr.ca
- Airborne Geophysics
- Geological Survey of Canada, Ottawa
-